<template>
    <div class="homerecommendlist">
        <HomeCommendItem v-for="(item,index) in list" :key="index" :item="item" class="thisitem"></HomeCommendItem>
    </div>
</template>

<script setup lang="ts">
import { ref,defineProps } from 'vue'
import axios from '@/api/axios'
import HomeCommendItem from './HomeCommendItem.vue';
const { thisid } = defineProps<{
  thisid: number
}>()
let list = ref([])
let page:number = ref(1)
axios
  .get(`/api/front/recommend/${thisid}?page=${page.value}&limit=20`)
  .then((res) => {
    list.value = res.data.data.list
    console.log(444, list.value) // 检查返回的数据结构

  })
  .catch((error) => {
    console.error('Error fetching data:', error)
  })
</script>

<style scoped lang="less">
.homerecommendlist{
    padding: 14rem;
    width: 100vw;
    display: flex;
    flex-wrap: wrap;
    .thisitem:nth-child(2n-1){
        margin-right: 13rem;
    }
}
</style>